package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type UserInfo struct{
	Name string
	Gender string
	Age int
}

func main() {
	r := gin.Default()
	r.LoadHTMLGlob("./templates/*")
	r.GET("/book", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "hello world!",
			"name":"罗小小",
			"age":"18",
			"gender":"男",
		})
	})
	r.PUT("/book", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"method": "PUT",
		})
	})
	r.DELETE("/book", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"method": "DELETE",
		})
	})
	r.POST("/book", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"method": "POST",
		})
	})
	r.GET("/hello", func(c *gin.Context) {
		c.HTML(http.StatusOK, "/hello.html", gin.H{
			"title": "posts/index",
		})
	})
	r.Run() // listen and serve on 0.0.0.0:8080
}


